import time
from datetime import datetime

# res1 = time.time() # 得到的是一个时间戳格式的数据
# print(res1, type(time)) # 2024-11-29 10:45:58
# s1 = datetime.now() # 获取当前时间的date对象
# print(s1, type(s1))
#
# # '2024年11月29日 10时51分00秒'
# # datetime -> str 日期格式化
# res1 = datetime.strftime(s1, '%Y-%m-%d %H:%M:%S')
# print(res1)
# print("-------------------------------")
# # time.time()
# # 时间戳 -> datetime
# tp = time.time() # 当前的时间戳
# print(tp)
# res2 = datetime.fromtimestamp(tp)
# print(res2, type(res2))
# # datetime -> str
# res3 = datetime.strftime(res2, '%Y/%m/%d %H:%M:%S')
# print(res3, type(res3))
# print("-------------------------------")
# # 字符串 -> datetime
# s2 = '2024/11/29 11:02:28'
# d2 = datetime.strptime(s2, '%Y/%m/%d %H:%M:%S')
# print(d2, type(d2))
# # datetime-> 时间戳
# tp2 = d2.timestamp()
# print(int(tp2))


tp = 1732849348
dt1 = datetime.fromtimestamp(tp)
print(f"{dt1.year}年{dt1.month}月{dt1.day} {dt1.hour}时{dt1.minute}分{dt1.second}秒")